package eu.danielhernandez.ejemplos.nombreceltibero.listener;

import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

import org.hibernate.SessionFactory;

import eu.danielhernandez.ejemplos.nombreceltibero.utilities.HibernateUtil;

public class RestoreViewPhaseListener implements PhaseListener{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5164545813066903983L;

	@Override
	public void afterPhase(PhaseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void beforePhase(PhaseEvent arg0) {
		SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
		sessionFactory.getCurrentSession().beginTransaction();
	}

	@Override
	public PhaseId getPhaseId() {
		return PhaseId.RESTORE_VIEW;
	}

}
